/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JFrame_principal.java
 *
 * Created on 09/04/2011, 17:17:48
 */

package formularios;

import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Ramon
 */
public class JFrame_principal extends javax.swing.JFrame {

    /** Creates new form JFrame_principal */
    public JFrame_principal() {
        initComponents();
       //abre a janela no centro da tela
        setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        menu_gerencial = new javax.swing.JMenu();
        subMenu_frmEmpregados = new javax.swing.JMenuItem();
        subMenu_frmConstrutora = new javax.swing.JMenuItem();
        subMenu_frmImoveis = new javax.swing.JMenuItem();
        menu_operacional = new javax.swing.JMenu();
        subMenu_frmCliente = new javax.swing.JMenuItem();
        subMenu_frmVenda = new javax.swing.JMenuItem();
        menu_relatorios = new javax.swing.JMenu();
        subMenu_vendedor = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });

        menu_gerencial.setMnemonic('G');
        menu_gerencial.setText("Gerencial");

        subMenu_frmEmpregados.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        subMenu_frmEmpregados.setMnemonic('E');
        subMenu_frmEmpregados.setText("Formulário Empregado");
        subMenu_frmEmpregados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subMenu_frmEmpregadosActionPerformed(evt);
            }
        });
        menu_gerencial.add(subMenu_frmEmpregados);

        subMenu_frmConstrutora.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        subMenu_frmConstrutora.setMnemonic('s');
        subMenu_frmConstrutora.setText("Formulário Construtora");
        subMenu_frmConstrutora.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subMenu_frmConstrutoraActionPerformed(evt);
            }
        });
        menu_gerencial.add(subMenu_frmConstrutora);

        subMenu_frmImoveis.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK));
        subMenu_frmImoveis.setMnemonic('v');
        subMenu_frmImoveis.setText("Formulário Imóveis");
        subMenu_frmImoveis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subMenu_frmImoveisActionPerformed(evt);
            }
        });
        menu_gerencial.add(subMenu_frmImoveis);

        jMenuBar1.add(menu_gerencial);

        menu_operacional.setMnemonic('O');
        menu_operacional.setText("Operacional");

        subMenu_frmCliente.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        subMenu_frmCliente.setMnemonic('n');
        subMenu_frmCliente.setText("Formulário Cliente");
        subMenu_frmCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subMenu_frmClienteActionPerformed(evt);
            }
        });
        menu_operacional.add(subMenu_frmCliente);

        subMenu_frmVenda.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        subMenu_frmVenda.setMnemonic('d');
        subMenu_frmVenda.setText("Formulário Venda");
        subMenu_frmVenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subMenu_frmVendaActionPerformed(evt);
            }
        });
        menu_operacional.add(subMenu_frmVenda);

        jMenuBar1.add(menu_operacional);

        menu_relatorios.setText("Relatórios");

        subMenu_vendedor.setText("Vendedor");
        subMenu_vendedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subMenu_vendedorActionPerformed(evt);
            }
        });
        menu_relatorios.add(subMenu_vendedor);

        jMenuBar1.add(menu_relatorios);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 822, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void subMenu_frmClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subMenu_frmClienteActionPerformed
       Formulario_cliente frm_cliente = new Formulario_cliente();
       jDesktopPane.add(frm_cliente);
       frm_cliente.show();
    }//GEN-LAST:event_subMenu_frmClienteActionPerformed

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        //libera memória e fecha janelas internas
        dispose();
    }//GEN-LAST:event_formWindowClosed

    private void subMenu_frmEmpregadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subMenu_frmEmpregadosActionPerformed
       Formulario_empregado frm_empregado = new Formulario_empregado();
       jDesktopPane.add(frm_empregado);
       frm_empregado.show();
    }//GEN-LAST:event_subMenu_frmEmpregadosActionPerformed

    private void subMenu_frmImoveisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subMenu_frmImoveisActionPerformed
       Formulario_imovel frm_imovel = new Formulario_imovel();
       jDesktopPane.add(frm_imovel);
       frm_imovel.show();
    }//GEN-LAST:event_subMenu_frmImoveisActionPerformed

    private void subMenu_frmVendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subMenu_frmVendaActionPerformed
       Formulario_venda frm_venda = new Formulario_venda();
       jDesktopPane.add(frm_venda);
       frm_venda.show();
    }//GEN-LAST:event_subMenu_frmVendaActionPerformed

    private void subMenu_frmConstrutoraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subMenu_frmConstrutoraActionPerformed
       Formulario_construtora frm_construtora = new Formulario_construtora();
       jDesktopPane.add(frm_construtora);
       frm_construtora.show();
    }//GEN-LAST:event_subMenu_frmConstrutoraActionPerformed

    private void subMenu_vendedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subMenu_vendedorActionPerformed
        
       Relatorio_vendedor rel_vend = new Relatorio_vendedor();
       jDesktopPane.add(rel_vend);
       rel_vend.show();
    }//GEN-LAST:event_subMenu_vendedorActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new JFrame_principal().setVisible(true);
            }
        });

    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane jDesktopPane;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenu menu_gerencial;
    private javax.swing.JMenu menu_operacional;
    private javax.swing.JMenu menu_relatorios;
    private javax.swing.JMenuItem subMenu_frmCliente;
    private javax.swing.JMenuItem subMenu_frmConstrutora;
    private javax.swing.JMenuItem subMenu_frmEmpregados;
    private javax.swing.JMenuItem subMenu_frmImoveis;
    private javax.swing.JMenuItem subMenu_frmVenda;
    private javax.swing.JMenuItem subMenu_vendedor;
    // End of variables declaration//GEN-END:variables

}
